<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="utf-8"/>
    <title>叫我小米商城的翻版</title>
    <link rel="stylesheet" type="text/css" href="css/public.css"/>
    <link rel="stylesheet" type="text/css" href="css/index.css"/>
    <script src="js/jquery-3.3.1.js"></script>

    <script>
        $(function () {
            $("#head").load("header.html");

            //当前登录用户
            $.get("user/findOne", {}, function (data) {
                var msg = "欢迎回来，" + data.nichen;
                $("#login").html(msg);
                $("#reg").html("退出登录");
                $("#reg").attr("href", "user/exit");
            });

            $.get("goods/findAll", {}, function (data) {
                var info = '<h2><img style="width: 100%" src="img/ad1.jpg"/></h2>';
                for (var i = 0; i < data.length / 4; i++) {
                    var divs = '<div class="pList clearfix tran"><a href="proDetail.html?gid='+ data[i].gid +'">\n' +
                        '            <dl>\n' +
                        '                <dt><span class="abl"></span><img style="width: 268px; height: 268px" src="'+data[i].showImg+'"/><span class="abr"></span></dt>\n' +
                        '                <dd>' + data[i].name + '</dd>\n' +
                        '                <dd><span>' + '￥' + data[i].price + '</span></dd>\n' +
                        '            </dl>\n' +
                        '        </a><a href="proDetail.html?gid='+ data[i+1].gid +'">\n' +
                        '            <dl>\n' +
                        '                <dt><span class="abl"></span><img style="width: 268px; height: 268px" src="'+data[i+1].showImg+'"/><span class="abr"></span></dt>\n' +
                        '                <dd>' + data[i + 1].name + '</dd>\n' +
                        '                <dd><span>' + '￥' + data[i + 1].price + '</span></dd>\n' +
                        '            </dl>\n' +
                        '        </a><a href="proDetail.html">\n' +
                        '            <dl>\n' +
                        '                <dt><span class="abl"></span><img style="width: 268px; height: 268px" src="'+data[i+2].showImg+'"/><span class="abr"></span></dt>\n' +
                        '                <dd>' + data[i + 2].name + '</dd>\n' +
                        '                <dd><span>' + '￥' + data[i + 2].price + '</span></dd>\n' +
                        '            </dl>\n' +
                        '        </a><a href="proDetail.html">\n' +
                        '            <dl>\n' +
                        '                <dt><span class="abl"></span><img style="width: 268px; height: 268px" src="'+data[i+3].showImg+'"/><span class="abr"></span></dt>\n' +
                        '                <dd>' + data[i + 3].name + '</dd>\n' +
                        '                <dd><span>' + '￥' + data[i + 3].price + '</span></dd>\n' +
                        '            </dl>\n' +
                        '        </a>\n' +
                        '        </div>';
                    info += divs;
                }
                $("#show").html(info);
            })

            $("#searchForm").submit(function () {
                $.post("goods/serchGoods", $("#searchForm").serialize(), function (data) {
                    for (var i = 0; i < data.length; i++) {
                        alert(data[i].name);
                    }
                })
            })
        })
    </script>
</head>
<body><!------------------------------head------------------------------>
<div class="head">
    <div class="wrapper clearfix">
        <div class="clearfix" id="top"><h1 class="fl"><a href="index.html"><img src="img/logo.png"/></a></h1>
            <div class="fr clearfix" id="top1">
                <p class="fl">
                    <a id="login" href="login.html">登录</a>
                    <a href="reg.html" id="reg">注册</a>
                </p>
                <form action="" method="post" id="searchForm" class="fl">
                    <input name="keywords" type="text"/>
                    <input type="submit" value=""/>
                </form>
                <div class="btn fl clearfix"><a href="mygxin.html"><img src="img/grzx.png"/></a><a href="#" class="er1"><img
                        src="img/ewm.png"/></a><a href="cart.html"><img src="img/gwc.png"/></a>
                    <p><a href="#"><img src="img/smewm.png"/></a></p></div>
            </div>
        </div>

        <!--  引入分类栏  -->
        <div id="head"></div>

    </div>
</div><!-------------------------banner--------------------------->
<div class="block_home_slider">
    <div id="home_slider" class="flexslider">
        <ul class="slides">
            <li>
                <div class="slide"><img src="img/ban1.jpg"/></div>
            </li>
            <li>
                <div class="slide"><img src="img/ban2.jpg"/></div>
            </li>
            <li>
                <div class="slide"><img src="img/banner3.jpg"/></div>
            </li>
        </ul>
    </div>
</div><!------------------------------thImg------------------------------>
<div class="thImg">
    <div class="clearfix"><a href="#"><img src="img/th1.jpg"/></a><a href="#"><img
            src="img/th2.jpg"/></a><a href="#"><img src="img/th3.jpg"/></a></div>
</div><!------------------------------news------------------------------>

<div class="people">
    <div id="show" class="wrapper">
        <h2><img style="width: 100%" src="img/ad1.jpg"/></h2>
        <div class="pList clearfix tran"><a href="proDetail.html">
            <dl>
                <dt><span class="abl"></span><img src="img/s7.jpg"/><span class="abr"></span></dt>
                <dd>【最家】不锈钢壁饰墙饰软装</dd>
                <dd><span>￥688.00</span></dd>
            </dl>
        </a><a href="proDetail.html">
            <dl>
                <dt><span class="abl"></span><img src="img/s10.jpg"/><span class="abr"></span></dt>
                <dd>【最家】小城动物木板画壁挂北欧</dd>
                <dd><span>￥188.00</span></dd>
            </dl>
        </a><a href="proDetail.html">
            <dl>
                <dt><span class="abl"></span><img src="img/s4.jpg"/><span class="abr"></span></dt>
                <dd>【最家】玄关假山水壁饰背景墙饰挂件创意</dd>
                <dd><span>￥599.00</span></dd>
            </dl>
        </a><a href="proDetail.html">
            <dl>
                <dt><span class="abl"></span><img src="img/s9.jpg"/><span class="abr"></span></dt>
                <dd>【最家】金属树枝壁饰铜鸟装饰品</dd>
                <dd><span>￥928.00</span></dd>
            </dl>
        </a>
        </div>
    </div>
</div><!--返回顶部-->

<div class="news">

</div><!------------------------------ad------------------------------><a href="#" class="ad"><img
        src="img/pen.jpg"/></a><!------------------------------people------------------------------>

<div class="gotop"><a href="cart.html">
    <dl>
        <dt><img src="img/gt1.png"/></dt>
        <dd>去购<br/>物车</dd>
    </dl>
</a><a href="#" class="dh">
    <dl>
        <dt><img src="img/gt2.png"/></dt>
        <dd>联系<br/>客服</dd>
    </dl>
</a><a href="mygxin.html">
    <dl>
        <dt><img src="img/gt3.png"/></dt>
        <dd>个人<br/>中心</dd>
    </dl>
</a><a href="#" class="toptop" style="display: none">
    <dl>
        <dt><img src="img/gt4.png"/></dt>
        <dd>返回<br/>顶部</dd>
    </dl>
</a>
    <p>400-800-8200</p></div><!-------------------login--------------------------><!--footer-->
<div class="footer">
    <div class="top">
        <div class="wrapper">
            <div class="clearfix"><a href="#2" class="fl"><img src="img/foot1.png"/></a><span class="fl">7天无理由退货</span>
            </div>
            <div class="clearfix"><a href="#2" class="fl"><img src="img/foot2.png"/></a><span class="fl">15天免费换货</span>
            </div>
            <div class="clearfix"><a href="#2" class="fl"><img src="img/foot3.png"/></a><span class="fl">满599包邮</span>
            </div>
            <div class="clearfix"><a href="#2" class="fl"><img src="img/foot4.png"/></a><span class="fl">手机特色服务</span>
            </div>
        </div>
    </div>
    <p class="dibu">最家家居&copy;2013-2017公司版权所有 京ICP备080100-44备0000111000号<br/>
        违法和不良信息举报电话：400-800-8200，本网站所列数据，除特殊说明，所有数据均出自我司实验室测试</p></div>
<script src="js/jquery-1.12.4.min.js" type="text/javascript" charset="utf-8"></script>
<script src="js/public.js" type="text/javascript" charset="utf-8"></script>
<script src="js/nav.js" type="text/javascript" charset="utf-8"></script>
<script src="js/jquery.flexslider-min.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">$(function () {
    $('#home_slider').flexslider({
        animation: 'slide',
        controlNav: true,
        directionNav: true,
        animationLoop: true,
        slideshow: true,
        slideshowSpeed: 2000,
        useCSS: false
    });
});</script>
</body>
</html>